﻿using System.Collections.Generic;
using UnityEngine;

namespace BridgeShips
{
    public class EntityData : ScriptableObject
    {
        [SerializeField]
        private List<AttributeData> m_AttributeDatas = null;

        private Dictionary<EntityAttributeType, int> m_Attribute = null;
        public Dictionary<EntityAttributeType, int> Attributes
        {
            get
            {
                if (m_AttributeDatas == null) return null;
                if (m_Attribute == null)
                {
                    m_Attribute = new Dictionary<EntityAttributeType, int>();
                    for (int i = 0; i < m_AttributeDatas.Count; i++)
                    {
                        m_Attribute.Add(m_AttributeDatas[i].Key, m_AttributeDatas[i].Value);
                    }
                }
                return m_Attribute;
            }
        }
        
        [System.Serializable]
        public struct AttributeData
        {
            public EntityAttributeType Key;
            public int Value;
        }
    }
    
}
